package com.hubujun.driverlicense.model;

import com.hubujun.driverlicense.util.Ln;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by Administrator on 2016/5/28 0028.
 */
public class QuestionModel {
    public int id;
    public String question;
    public String answer;
    public String item1;
    public String item2;
    public String item3;
    public String item4;
    public String explains;
    public String url;

    public void copyFromJsonObject(JSONObject jsonObject) {
        try {
            if (jsonObject.has("id")) {
                this.id = jsonObject.getInt("id");
            }
            if (jsonObject.has("question")){
                this.question = jsonObject.getString("question");
            }
            if (jsonObject.has("answer")){
                this.answer = jsonObject.getString("answer");
            }
            if (jsonObject.has("item1")){
                this.item1 = jsonObject.getString("item1");
            }
            if (jsonObject.has("item2")){
                this.item2 = jsonObject.getString("item2");
            }
            if (jsonObject.has("item3")){
                this.item3 = jsonObject.getString("item3");
            }
            if (jsonObject.has("item4")){
                this.item4 = jsonObject.getString("item4");
            }
            if (jsonObject.has("explains")){
                this.explains = jsonObject.getString("explains");
            }
            if (jsonObject.has("url")){
                this.url = jsonObject.getString("url");
            }
        } catch (JSONException e) {
            Ln.e(e);
        }
    }
}
